<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>用户注册审核</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../plugins/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="../plugins/layui/css/myPage.css">
</head>
<body class="layui-layout-body">


<blockquote class="layui-elem-quote"  >
    <div class=" layui-form" >
        <div class="layui-form-item"  >


            <div class="layui-input-inline" style="width: 130px">


                <select name="" lay-filter="dingdan" id="ydSearchKind" >
                    <option value="">搜索类型</option>
                    <option value="shzt">审核状态</option>
                    <option value="sfzh">身份证号</option>
                    <option value="xingming">姓名</option>

                </select>
            </div>
            <div class="layui-input-inline" id="searchContentCon">

                <div id="ydSearchContentCon">
                    <select class="layui-input" id="ydSearchContent" lay-search> <option value="">请选择</option></select>
                </div>
            </div>








            <div class="layui-input-inline" style="width:17%; position: absolute;right: 0" >
                <button class="layui-btn layui-btn-normal" id="search">点击搜索</button>
            </div>

            <div class="layui-input-inline" style="width:10%; position: absolute;right: 0" >
                <button type="button" class="layui-btn layui-btn-normal" id="all">显示全部</button>
            </div>




        </div>
    </div>
</blockquote>
<div class="layui-row">
    <div class="layui-col-xs12">



        <script type="text/html" id="opera">


            <button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="detail" >查看</button>


            <!--{{#  if( getQueryVariable("R") == "false"){ }}-->
            <!--<button class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled" disabled lay-event="detail" >查看</button>-->
            <!--<button class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled"  disabled lay-event="check">审核</button>-->
            <!--<button class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled"  disabled lay-event="remark">添加备注</button>-->

            <!--{{# }else{ }}-->

            <!--<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="detail" >查看</button>-->
            <!--{{#  if( getQueryVariable("CH") == "false"){ }}-->
            <!--<button class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled"  disabled lay-event="check">审核</button>-->
            <!--<button class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled"  disabled lay-event="remark">添加备注</button>-->

            <!--{{# }else{ }}-->
            <!--<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="check">审核</button>-->
            <!--<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="remark">添加备注</button>-->

            <!--{{# } }}-->



            <!--{{# } }}-->

        </script>
        <table id="table" lay-filter="Table"></table>
        <div id="laypage"></div>
        <script type="text/html" id="selectTpl_type">
            {{d.cph}}
        </script>

        <script type="text/html" id="zzc">

            {{# if(parseFloat(d.zzc) > parseFloat(d.zcsx)){ }}
            <div style="background:red;">{{d.zzc}}</div>
            {{# } else { }}
            {{d.zzc}}
            {{# } }}
        </script>
        <script type="text/html" id="ydztfix">
            {{# if(d.ydzt.indexOf('_') != -1){ }}
            {{d.ydzt.split('_')[1]}}
            {{#   }else{ }}
            {{d.ydzt }}
            {{# } }}
        </script>
    </div>






<script src="../plugins/layui/layui.js"></script>
<script src="../js/config.js"></script>
<script src="../js/tools.js"></script>
<script src="../js/autocomplete.js"></script>
<script>
    //JavaScript代码区域
    layui.use(['form' ,'table','jquery','layer','element','laydate','laypage'], function(){
        var form = layui.form;
        var table = layui.table;
        var $ = layui.$;
        var element = layui.element;
        var layer = layui.layer;
        var laydate = layui.laydate;
        var tableheight=  'full-200';
        var tablewidth = 90;
        var currentPage = 1;
        var cphData=[];
        var elemNull = {};
        var limitcount = 10;
        var curnum = 1;
        var laypage = layui.laypage;
        var tablehead = [[ //表头
            {type:'numbers', title: '序号',  align:'center'}
            ,{field: 'sfzh', title: '身份证号' ,align:'center'}

            ,{field: 'xingming', title: '姓名' , width:120 ,align:'center'}

            ,{field: 'sjhm', title: '手机号' ,  align:'center'}
            ,{field: 'jsznjrq', title: '驾驶证年检日期' ,  align:'center'}
            ,{field: 'cyzgznjrq', title: '从业资格证年检日期' ,align:'center'}
            ,{field: 'shzt', title: '审核状态' ,align:'center'}
            ,{field: 'lasttime', title: '注册时间' ,align:'center'}
            ,{ title:'操作', align:'center', toolbar: '#opera'}
        ]]
        // elemNull.value = "&nbsp";
        // elemNull.text = "&nbsp";
        // cphData[0] = elemNull;

        //获取 cphData
        // $.ajax({
        //     url: contextPath+"/driverapp",
        //     type: "GET",
        //     contentType:"application/json;charset=utf-8",
        //     dataType:"json",
        //     success: function(res) {
        //         for(var i in res.list){
        //             var elem = {};
        //             elem.value = res.list[i].clid;
        //             elem.text = res.list[i].cph;
        //             cphData[i+1] = elem;
        //         }
        //
        //
        //     }
        //
        // });


        //  渲染搜索 select

        // yewuSearch(form,$);
        yewuSearchyhzc(form,$);



        registeCheck(curnum, limitcount);
        function registeCheck(start,limitsize) {
            layui.use(['table','laypage','laydate'], function(){
                var table = layui.table,
                    laypage = layui.laypage;
                table.render({
                    url: contextPath + "driverapp?pageNum="+start+"&pageSize="+limitsize,
                    elem: '#table',
                    height: tableheight,
                    page: false,
                    id: 'table',
                    cellMinWidth: tablewidth,
                    cols: tablehead,
                    done: function (res, curr,count) {
                        laypage.render({
                            elem: 'laypage'
                            , count: count
                            , curr: curnum
                            , limit: limitcount
                            , layout: ['prev', 'page', 'next', 'skip', 'count', 'limit']
                            , jump: function (obj, first) {
                                if (!first) {
                                    curnum = obj.curr;
                                    limitcount = obj.limit;
                                    //console.log("curnum"+curnum);
                                    //console.log("limitcount"+limitcount);
                                    //layer.msg(curnum+"-"+limitcount);
                                    registeCheck(curnum, limitcount);
                                }
                            }
                        });
                    }
                });
            });
        }

        function registeChecksearch(start,limitsize) {
            layui.use(['table','laypage','laydate'], function(){
                var table = layui.table,
                    laypage = layui.laypage;
                table.render({
                    url: contextPath + "driverapp?pageNum="+start+"&pageSize="+limitsize+"&"+$("#ydSearchKind").val()+"="+$("#ydSearchContent").val(),
                    elem: '#table',
                    height: tableheight,
                    page: false,
                    id: 'table',
                    cellMinWidth: tablewidth,
                    cols: tablehead,
                    done: function (res, curr,count) {
                        laypage.render({
                            elem: 'laypage'
                            , count: count
                            , curr: curnum
                            , limit: limitcount
                            , layout: ['prev', 'page', 'next', 'skip', 'count', 'limit']
                            , jump: function (obj, first) {
                                if (!first) {
                                    curnum = obj.curr;
                                    limitcount = obj.limit;
                                    //console.log("curnum"+curnum);
                                    //console.log("limitcount"+limitcount);
                                    //layer.msg(curnum+"-"+limitcount);
                                    registeChecksearch(curnum, limitcount);
                                }
                            }
                        });
                    }
                });
            });
        }

        //执行一个laydate实例
        laydate.render({
            elem: '#ydrq' //指定元素
            ,format:'yyyy-MM-dd'
            ,theme:'#0099FF'

        });
        laydate.render({
            elem: '#searchQsrqContent' //指定元素
            ,format:'yyyy-MM-dd'
            ,theme:'#0099FF'
        });
        laydate.render({
            elem: '#searchJsrqContent' //指定元素
            ,format:'yyyy-MM-dd'
            ,theme:'#0099FF'

        });



//请求车牌号




        //刷新table实例
        $("#all").on('click',function () {
            registeCheck(curnum, limitcount);
        });
        table.on('tool(Table)', function(obj){ //注：tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
            var data = obj.data //获得当前行数据
                ,layEvent = obj.event; //获得 lay-event 对应的值
            if(layEvent === 'detail'){


                //
                // if(obj.data.ydzt == "调度_审核中" || obj.data.ydzt == "订单_审核中" ||obj.data.ydzt == "快捷_审核中" || obj.data.ydzt == "报账_审核中" || obj.data.ydzt == "登记_审核中"){
                //     obj.data.ydzt = "审核中";
                // }
                // if(obj.data.ydzt == "快捷_已完成"){
                //     obj.data.ydzt = "已完成";
                // }

                layer.open({

                    type: 2,
                    title: '查看用户注册信息',
                    maxmin: true,
                    //点击遮罩关闭层
                    shadeClose:false,
                    area : ['1400px' , '800px'],
                    content: ['./lookRegiste.html'],
                    success:function(layero,index){
                        // console.log(data);
                        var body = layer.getChildFrame('body',index);
                        console.log(data);
                        for(var i in data){
                            body.contents().find("[name='"+i+"']").val(eval("data."+i));
                        }
                    },
                    end:function(){
                        registeCheck(curnum, limitcount);
                    }
                });

            }

        });


//搜索
        $("#search").on('click',function(){
            if($("#ydSearchKind").val() != "" && $("#ydSearchContent").val() != ""){
                var limitcount = 10;
                var curnum = 1;
                registeChecksearch(curnum, limitcount);
            }else if($("#ydSearchKind").val() != "" && $("#ydSearchContent").val() == ""){
                layer.msg("搜索内容不能为空！");
            }else if($("#ydSearchKind").val() == "" && $("#ydSearchContent").val() != ""){
                layer.msg("搜索类型不能为空！");
            }else if($("#ydSearchKind").val() == "" && $("#ydSearchContent").val() == ""){
                var limitcount = 10;
                var curnum = 1;
                registeCheck(curnum, limitcount);
            }

        });


    });





</script>
</body>
</html>